package cn.bgs.controller;

import cn.bgs.pojo.Goods;
import cn.bgs.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.List;


@Controller
@RequestMapping("/product")
public class GoodsController {

    Logger log = LogManager.getLogger();

    @Autowired
    private GoodsService goodsService;


    @RequestMapping("/findAllGoods")
    public String findAllGoods(Model mo){
        List<Goods> allGoods = goodsService.findAllGoods();
        mo.addAttribute("goods",allGoods);
        return "/view/goodsInfo";
    }

}
